<!DOCTYPE html>

<body>
<script src="/js-test-resources/js-test.js"></script>
<script>
description('This tests that XMLHttpRequest.responseXML returns an XMLDocument.');
window.jsTestIsAsync = true;    

new Promise(function(resolve, reject) {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', 'resources/redirect.php?url=reply2.xml', true);
    xhr.responseType = 'document';
    xhr.onreadystatechange = function() {
        if (xhr.readyState === 4) {
            resolve(xhr);
        }
    }
    xhr.send();
}).then(function(xhr) {
    responseDocument = String(xhr.responseXML);
    shouldBeEqualToString('responseDocument', '[object XMLDocument]');
}).catch(function(reason) {
    testFailed(String(reason));
}).then(finishJSTest, finishJSTest);

</script>
</body>
</html>
